package com.lab.book.web.config;

import javax.validation.Validation;
import javax.validation.Validator;

import org.hibernate.validator.HibernateValidator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ValidatorConfig {
	@Bean
	public Validator localValidatorFactoryBean() {
		// LocalValidatorFactoryBean a = new LocalValidatorFactoryBean();
		Validator validator = Validation.byProvider(HibernateValidator.class).configure().failFast(true)
				.buildValidatorFactory().getValidator();

		return validator;
	}
}